<?php
class Modules_Common_Design_Table
{
	private $rows=array();
	public $styles=array();
	public $header=Array();
	
	public function AddRows(Modules_Common_Design_Rows $rows)
	{
		$rows->style=$this->styles["TableRow"];
		$this->rows[]=$rows;
		
	}
	public function __construct(Modules_Common_Design_RowsHeader $header)
	{
		$this->styles["table"]="tableDefault";
		$this->styles["header"]="tableDefaultHeader";
		$this->styles["headerElements"]="tableDefaultHeaderElements";
		$this->styles["TableRow"]="tableDefaultRow";
	 	foreach($header->header_rows as $key=>$value)
	 		$this->header[$value]=1;
	}

	
	public function Draw()
	{
		$str= "<table class=\"".$this->styles["table"]."\""."><tr>";
		foreach($this->header as $headerElement =>$value )
		{
			$str.= "<th class=\"".$this->styles["headerElements"]."\">";
			$str.= $headerElement;
			$str.= "</th>";
		}
		$str.="</tr>";
		foreach($this->rows as $row )
		{
			$str.= "<tr class=\"".$this->styles["TableRow"]."\">";
			$str.= $row;
			$str.= "</tr>";
		}
		$str.= "</table>";
		return $str;
	}
	
}